package com.cmhi.base.provider;

import android.content.Context;
import android.util.ArrayMap;

import com.softmbh.kellyplatform.util.AppUtils;

public abstract class BimDataManager {
    private static AppInfoManager appInfoManager;
    private static ShareInfoManager shareInfoManager;
    private static ArrayMap<String,String> appInfoMap;
    private static Context mContext;
    public BimDataManager() {
    }
    public static void init(Context context) {
        mContext= context.getApplicationContext();
        AppUtils.debugLog("Init: caller=" + mContext.getPackageName());
    }

    public static AppInfoManager getAppInfoInstance() {
        if (appInfoManager == null) {
            synchronized (BimDataManager.class) {
                if (appInfoManager == null) {
                    appInfoManager = new AppInfoManager(mContext);
                }
            }
        }
        return appInfoManager;
    }

    public static ShareInfoManager getShareInfoManager() {
        if (shareInfoManager == null) {
            synchronized (BimDataManager.class) {
                if (shareInfoManager == null) {
                    shareInfoManager = new ShareInfoManager(mContext);
                }
            }
        }
        return shareInfoManager;
    }
    public static ArrayMap<String, String> getAppInfoMap() {
        if (appInfoMap == null) {
            synchronized (BimDataManager.class) {
                if (appInfoMap == null) {
                    appInfoMap = new ArrayMap<>();
                }
            }
        }
        return appInfoMap;
    }

    public abstract String getValue(String key);

    public abstract void update(String key, String value);

    public abstract void delete(String key);

}
